<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
#div1{
    width:200px; height:200px; background:red; position:absolute; left:200px; top:150px; margin:50px;
}
    </style>
    <script>

    </script>
</head>
<body>
<div id="div1" onclick="alert(this.offsetLeft);"></div>
</body>
</html>
<!--offsetLeft--获取左边距>
<!--offsetTop--获取上边距>
<!--offsetWidth--获取物体的宽度>
<!--offsetHeight--获取物体的高度>